import { DicesUtil } from "../../common/dice/DicesUtil";
import { LoaderManager } from "../../../../../com/gengine/resource/LoaderManager";
import { SWFInfo } from "../../../../../com/gengine/resource/info/SWFInfo";
import { DiceBarSkin } from "./DiceBarSkin";
import { HumanHand } from "./HumanHand";
import { DiceRuningType } from "../../common/dice/DiceRuningType";
type int = number;
//class LGXBDice
    
    export  class LGXBDice extends DicesUtil
    {
        constructor()
        {
            super();
            LoaderManager.instance.load("LGXBDice.swf", this.onLoadedHandler);
            return;
        }

        /* internal  */onLoadedHandler(arg1: SWFInfo): void
        {
            var loc7=null;
            var loc1=arg1.getAssetClass("dice2");
            var loc2=arg1.getAssetClass("loading2");
            var loc3=arg1.getAssetClass("hand2");
            var loc4=arg1.getAssetClass("areaSprite2");
            var loc5=new DiceBarSkin(new loc2());
            var loc6=new HumanHand(new loc3());
            this.initView(loc1, 1, loc5, loc6, loc7);
            return;
        }

        public /* override */ startPlay(arg1: int=-1): void
        {
            if (this.jumpAnimate) 
            {
                super.startPlay(DiceRuningType.ShowResult);
            }
            else 
            {
                super.startPlay(DiceRuningType.AllRun);
            }
            return;
        }

        protected /* override */ getDiceDropDownFromY(arg1: int): number
        {
            return -70 - 200;
        }

        protected /* override */ getRondomPoints(): Array<any>
        {
            var loc1=0;
            if (!this._tempPoints) 
            {
                this._tempPoints = new Array<any>();
                loc1 = 0;
                while (loc1 < _diceNum) 
                {
                    this._tempPoints[loc1] = new Object /* flash.geom.Point */();
                    this._tempPoints[loc1].x = 0;
                    this._tempPoints[loc1].y = -70;
                    ++loc1;
                }
            }
            return this._tempPoints;
        }

        protected /* override */ callPlayEndFunction(): void
        {
            flash.utils.clearTimeout(this._timeId);
            this._timeId = flash.utils.setTimeout(this.delayToCall, 700);
            return;
        }

        /* internal  */delayToCall(): void
        {
            super.callPlayEndFunction();
            return;
        }

        public /* var */jumpAnimate: Boolean=false;

        /* internal */ /* var */_tempPoints: Array<any>;

        /* internal */ /* var */_timeId: int=-1;
    }
